var userSvc = require("../../services/userSvc");
//初始化数据
exports.data = function (req, res) {
    userSvc.data(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//初始化电商数据
exports.shopData = function (req, res) {
    userSvc.shopData(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//好友个人主页
exports.userHomepage = function (req, res) {
    res.render("see/userHomepage");
};
//自媒体用户信息
exports.getUserInfo = function (req, res) {
    userSvc.getUserInfo(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//通过用户id 返回用户的自媒体列表
exports.getUserMediasList = function (req, res) {
    userSvc.getUserMediasList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//通过用户id 返回用户的商品列表
exports.getUserProductsList = function (req, res) {
    userSvc.getUserProductsList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//地址管理
exports.address = function (req, res) {
    res.render("see/address");
};
//用户收货地址
exports.getUserDeliveryAddressList = function (req, res) {
    userSvc.getUserDeliveryAddressList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//添加收货地址
exports.addAddress = function (req, res) {
    res.render("see/addAddress");
};
//添加修改用户收货地址
exports.addUserDeliveryAddress = function (req, res) {
    userSvc.addUserDeliveryAddress(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//删除用户收货地址
exports.deleteUserDeliveryAddress = function (req, res) {
    userSvc.deleteUserDeliveryAddress(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//我的商品
exports.myGoods = function (req, res) {
    res.render("see/myGoods");
};
//添加商品
exports.addGoods = function (req, res) {
    res.render("see/addGoods");
};
//添加商品详情
exports.addGoodsInfo = function (req, res) {
    res.render("see/addGoodsInfo");
};
//运费模板
exports.freightTemplate = function (req, res) {
    res.render("see/freightTemplate");
};
//运费列表
exports.freightList = function (req, res) {
    userSvc.freightList(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//修改运费模板
exports.modifyTemplate = function (req, res) {
    res.render("see/modifyTemplate");
};
//新建运费模板
exports.newTemplate = function (req, res) {
    res.render("see/newTemplate");
};
//保存运费(增加和修改运费)
exports.savefreight = function (req, res) {
    userSvc.savefreight(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//删除运费
exports.deletefreight = function (req, res) {
    userSvc.deletefreight(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//删除子运费
exports.deleteareafreight = function (req, res) {
    userSvc.deleteareafreight(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//个人商品详情
exports.userGoodsInfo = function (req, res) {
    res.render("see/userGoodsInfo");
};
//获取个人商品详情
exports.getMediaProductById = function (req, res) {
    userSvc.getMediaProductById(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//企业信息
exports.enterpriseInfo = function (req, res) {
    res.render("see/enterpriseInfo");
};
//登录
exports.loginIndex = function (req, res) {
    res.render("see/loginIndex");
};
//手机验证码登录
exports.telLogin = function (req, res) {
    res.render("see/telLogin");
};
//预发短信
exports.presendMessage = function (req, res) {
    userSvc.presendMessage(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//注册短信
exports.sendregistermessage = function (req, res) {
    userSvc.sendregistermessage(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//注册
exports.register = function (req, res) {
    userSvc.register(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//登录短信
exports.sendloginmessage = function (req, res) {
    userSvc.sendloginmessage(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//忘记密码短信
exports.sendforgetmessage = function (req, res) {
    userSvc.sendforgetmessage(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//设置忘记密码
exports.setForgetCode = function (req, res) {
    userSvc.setForgetCode(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//通过用户手机号 密码登录
exports.weblogin = function (req, res) {
    userSvc.weblogin(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//通过用户手机号 验证码登录
exports.webloginByCode = function (req, res) {
    userSvc.webloginByCode(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//完善个人信息-第一步
exports.perfectUserInfo = function (req, res) {
    res.render("see/perfectUserInfo");
};
//完善个人信息-第一步
exports.setFirstInfo = function (req, res) {
    userSvc.setFirstInfo(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//完善个人信息-第二步
exports.addName = function (req, res) {
    res.render("see/addName");
};
//完善个人信息-第三步
exports.myLable = function (req, res) {
    res.render("see/myLable");
};
//获取个人标签
exports.getUserLabel = function (req, res) {
    userSvc.getUserLabel(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//保存个人标签
exports.saveUserLabel = function (req, res) {
    userSvc.saveUserLabel(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//推荐用户
exports.recommendFans = function (req, res) {
    userSvc.recommendFans(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//获取用户乐币
exports.getUserIntegral = function (req, res) {
    userSvc.getUserIntegral(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};
//感兴趣内容
exports.myInterest = function (req, res) {
    res.render("see/myInterest");
};
//充值
exports.recharge = function (req, res) {
    res.render("see/recharge");
};
//获取配置文件
exports.releaseConfig = function (req, res) {
    userSvc.releaseConfig(req.body, null, function (b) {
        if (b.error || b.json.code !== 200) {
            res.send(b.json);
        } else {
            res.send(b.body);
        }
    });
};